import 'package:finance_app/src/entities/soa_entity.dart';

sOAEntityFromJson(SOAEntity data, Map<String, dynamic> json) {
	if (json['id'] != null) {
		data.id = json['id'] is String
				? int.tryParse(json['id'])
				: json['id'].toInt();
	}
	if (json['company_id'] != null) {
		data.companyId = json['company_id'] is String
				? int.tryParse(json['company_id'])
				: json['company_id'].toInt();
	}
	if (json['payment_instruction'] != null) {
		data.paymentInstruction = json['payment_instruction'].toString();
	}
	if (json['additional_note'] != null) {
		data.additionalNote = json['additional_note'].toString();
	}
	if (json['created_by'] != null) {
		data.createdBy = json['created_by'].toString();
	}
	if (json['created_at'] != null) {
		data.createdAt = json['created_at'].toString();
	}
	if (json['updated_at'] != null) {
		data.updatedAt = json['updated_at'].toString();
	}
	if (json['deleted_at'] != null) {
		data.deletedAt = json['deleted_at'];
	}
	return data;
}

Map<String, dynamic> sOAEntityToJson(SOAEntity entity) {
	final Map<String, dynamic> data = new Map<String, dynamic>();
	data['id'] = entity.id;
	data['company_id'] = entity.companyId;
	data['payment_instruction'] = entity.paymentInstruction;
	data['additional_note'] = entity.additionalNote;
	data['created_by'] = entity.createdBy;
	data['created_at'] = entity.createdAt;
	data['updated_at'] = entity.updatedAt;
	data['deleted_at'] = entity.deletedAt;
	return data;
}